﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>测试转换到Diagram坐标</title>
    <script src="../XEngine/LineUtil.js"></script>
    <script src="../XEngine/XEngine.js"></script>
    <script src="../XEngine/XSVG.js"></script>
    <script src="../XEngine/XNode.js"></script>
    <script src="../XWorkflow/XWFActivity.js"></script>

    <script type="text/javascript">
        var id = 0;
        window.onload = function () {
            // 初始化流程引擎
            XEngine.init(document.getElementById('container'));

            // 创建一个图表用于显示流程图
            var d1 = XEngine.createDiagram('d1');

            // 创建一个节点
            var rect1 = new XWFProcess('act' + id++);
            rect1.setPos(200, 200);
            rect1.setSize(50, 50);
            d1.add(rect1);

            // 显示图表
            XEngine.showDiagram(d1);

        }
        function refreshDebug(ptInWindow, ptInDiagram) {
            document.getElementById('debug').innerHTML = 'diagram:' + XEngine.getCurrentDiagram().getName() + ",ptInWindow:"
                + ptInWindow.x
            + ',' + ptInWindow.y + ',ptInDiagram:'
            + ptInDiagram.x + ',' + ptInDiagram.y;
        }

        window.onmousedown = function (e) {
            var ptInDiagram = XEngine.pointToDiagram(e);
            //var hitResult = XEngine.getCurrentDiagram().hitTest(ptInDiagram);
            refreshDebug(e, ptInDiagram);
        }
    </script>
</head>
<body>
    <h1>测试转换到Diagram坐标</h1>
    <div id="debug"></div>
    <div id="container" style="width:100%; height:600px; background:gray">

    </div>
</body>
</html>
